Source:NetHack 3.4.0/macwin.h
Below is the full text to macwin.h from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/macwin.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)macwin.h 3.4 1996/01/15 */ 2. /* Copyright © Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef MACWIN_H 6. # define MACWIN_H 7. #undef red /* undef internal color const strings from decl */ 8. #undef green 9. #undef blue 10. #include 11. #include 12. 13. /* more headers */ 14. #ifdef THINK_C 15. #include /* for CtoPStr and PtoCStr */ 16. #endif 17. 18. /* resources */ 19. #define PLAYER_NAME_RES_ID 1001 20. 21. /* fake some things if we don't have universal headers.. */ 22. #ifndef NewUserItemProc 23. typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo); 24. typedef UserItemProcPtr UserItemUPP; 25. #define NewUserItemProc(p) (UserItemUPP)(p) 26. 27. typedef pascal void (*ControlActionProcPtr)(ControlHandle theControl, short partCode); 28. typedef ControlActionProcPtr ControlActionUPP; 29. #define NewControlActionProc(p) (ControlActionUPP)(p) 30. 31. typedef ModalFilterProcPtr ModalFilterUPP; 32. #define DisposeRoutineDescriptor(p) 33. #endif 34. 35. /* misc */ 36. #ifdef __MWERKS__ 37. # define ResumeProcPtr long /* for call to InitDialogs */ 38. #endif 39. 40. /* working dirs structure */ 41. typedef struct macdirs { 42. Str32 dataName; 43. short dataRefNum; 44. long dataDirID; 45. 46. Str32 saveName; 47. short saveRefNum; 48. long saveDirID; 49. 50. Str32 levelName; 51. short levelRefNum; 52. long levelDirID; 53. } MacDirs; 54. 55. typedef struct macflags { 56. Bitfield (processes, 1); 57. Bitfield (color, 1); 58. Bitfield (folders, 1); 59. Bitfield (tempMem, 1); 60. Bitfield (help, 1); 61. Bitfield (fsSpec, 1); 62. Bitfield (trueType, 1); 63. Bitfield (aux, 1); 64. Bitfield (alias, 1); 65. Bitfield (standardFile, 1); 66. Bitfield (hasDebugger, 1); 67. Bitfield (hasAE, 1); 68. Bitfield (gotOpen, 1); 69. } MacFlags; 70. 71. extern MacDirs theDirs; /* used in macfile.c */ 72. extern MacFlags macFlags; 73. 74. /* 75. * Mac windows 76. */ 77. #define NUM_MACWINDOWS 15 78. #define TEXT_BLOCK 512L 79. 80. /* Window constants */ 81. #define kMapWindow 0 82. #define kStatusWindow 1 83. #define kMessageWindow 2 84. #define kTextWindow 3 85. #define kMenuWindow 4 86. #define kLastWindowKind kMenuWindow 87. 88. /* 89. * This determines the minimum logical line length in text windows 90. * That is; even if physical width is less, this is where line breaks 91. * go at the minimum. 350 is about right for score lines with a 92. * geneva 10 pt font. 93. */ 94. #define MIN_RIGHT 350 95. 96. typedef struct { 97. anything id; 98. char accelerator; 99. char groupAcc; 100. short line; 101. } MacMHMenuItem; 102. 103. typedef struct NhWindow { 104. WindowPtr its_window; 105. 106. short font_number; 107. short font_size; 108. short char_width; 109. short row_height; 110. short ascent_height; 111. 112. short x_size; 113. short y_size; 114. short x_curs; 115. short y_curs; 116. 117. short last_more_lin; /* Used by message window */ 118. short save_lin; /* Used by message window */ 119. 120. short miSize; /* size of menu items arrays */ 121. short miLen; /* number of menu items in array */ 122. MacMHMenuItem **menuInfo; /* Used by menus (array handle) */ 123. char menuChar; /* next menu accelerator to use */ 124. short **menuSelected; /* list of selected elements from list */ 125. short miSelLen; /* number of items selected */ 126. short how; /* menu mode */ 127. 128. char drawn; 129. Handle windowText; 130. long windowTextLen; 131. short scrollPos; 132. ControlHandle scrollBar; 133. } NhWindow; 134. 135. extern Boolean CheckNhWin(WindowPtr mac_win); 136. 137. 138. #define NUM_STAT_ROWS 2 139. #define NUM_ROWS 22 140. #define NUM_COLS 80 /* We shouldn't use column 0 */ 141. #define QUEUE_LEN 24 142. 143. extern NhWindow * theWindows; 144. 145. extern struct window_procs mac_procs; 146. 147. #define NHW_BASE 0 148. extern winid BASE_WINDOW, WIN_MAP, WIN_MESSAGE, WIN_INVEN, WIN_STATUS; 149. 150. 151. /* 152. * External declarations for the window routines. 153. */ 154. 155. #define E extern 156. 157. /* ### dprintf.c ### */ 158. 159. extern void dprintf (char *, ...); 160. 161. /* ### maccurs.c ### */ 162. 163. extern Boolean RetrievePosition (short, short *, short *); 164. extern Boolean RetrieveSize (short, short, short, short *, short *); 165. extern void SaveWindowPos (WindowPtr); 166. extern void SaveWindowSize (WindowPtr); 167. extern Boolean FDECL(RetrieveWinPos, (WindowPtr,short *,short *)); 168. 169. /* ### macerrs.c ### */ 170. 171. extern void showerror(char *,const char *); 172. extern Boolean itworked(short); 173. extern void mustwork(short); 174. extern void attemptingto(char *); 175. /* appear to be unused 176. extern void comment(char *,long); 177. extern void pushattemptingto(char *); 178. extern void popattempt(void); 179. */ 180. /* ### macfile.c ### */ 181. 182. /* extern char *macgets(int fd, char *ptr, unsigned len); unused */ 183. extern void FDECL(C2P,(const char *c, unsigned char *p)); 184. extern void FDECL(P2C,(const unsigned char *p, char *c)); 185. 186. /* ### macmenu.c ### */ 187. 188. extern void DoMenuEvt (long); 189. extern void InitMenuRes(void); 190. extern void AdjustMenus(short); 191. #define DimMenuBar() AdjustMenus(1) 192. #define UndimMenuBar() AdjustMenus(0) 193. 194. /* ### macmain.c ### */ 195. 196. extern void FDECL (process_openfile, (short s_vol, long s_dir, Str255 fNm, OSType ft)); 197. 198. /* ### macwin.c ### */ 199. 200. extern void AddToKeyQueue(unsigned char, Boolean); 201. extern unsigned char GetFromKeyQueue (void); 202. void trans_num_keys (EventRecord *); 203. extern void NDECL (InitMac); 204. int FDECL (try_key_queue, (char *)); 205. void FDECL (enter_topl_mode, (char *)); 206. void FDECL (leave_topl_mode, (char *)); 207. void FDECL (topl_set_resp, (char *, char)); 208. Boolean FDECL (topl_key, (unsigned char, Boolean)); 209. E void FDECL(HandleEvent, (EventRecord *)); /* used in mmodal.c */ 210. extern void NDECL(port_help); 211. 212. extern Boolean small_screen; 213. 214. E void FDECL(mac_init_nhwindows, (int *, char **)); 215. E void NDECL(mac_askname); 216. E void NDECL(mac_get_nh_event); 217. E void FDECL(mac_exit_nhwindows, (const char *)); 218. E winid FDECL(mac_create_nhwindow, (int)); 219. E void FDECL(mac_clear_nhwindow, (winid)); 220. E void FDECL(mac_display_nhwindow, (winid, BOOLEAN_P)); 221. E void FDECL(mac_destroy_nhwindow, (winid)); 222. E void FDECL(mac_curs, (winid,int,int)); 223. E void FDECL(mac_putstr, (winid, int, const char *)); 224. E void FDECL(mac_start_menu, (winid)); 225. E void FDECL(mac_add_menu, (winid,int,const anything *, 226. CHAR_P,CHAR_P,int,const char *, BOOLEAN_P)); 227. E void FDECL(mac_end_menu, (winid, const char *)); 228. E int FDECL(mac_select_menu, (winid, int, menu_item **)); 229. #ifdef CLIPPING 230. E void FDECL(mac_cliparound, (int, int)); 231. #endif 232. E int NDECL(mac_nhgetch); 233. E int FDECL(mac_nh_poskey, (int *, int *, int *)); 234. E int NDECL(mac_doprev_message); 235. E char FDECL(mac_yn_function, (const char *, const char *, CHAR_P)); 236. E void FDECL(mac_getlin, (const char *,char *)); 237. E int NDECL(mac_get_ext_cmd); 238. E void FDECL(mac_number_pad, (int)); 239. E void NDECL(mac_delay_output); 240. 241. #undef E 242. 243. #endif /* ! MACWIN_H */ macwin.h